using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: nnamthach@gmail.com 
	/// <summary>
	
    public class ACC_SYSInfo
    {
		#region Local Variable
		public enum Field
		{
			TKC1,
			TKC2,
			TKC3,
			TENTK,
			TCHAT
		}
		private String _TKC1;
		private String _TKC2;
		private String _TKC3;
		private String _TENTK;
		private Int16 _TCHAT;
		
		public String TKC1{	get{ return _TKC1;} set{_TKC1 = value;} }
		public String TKC2{	get{ return _TKC2;} set{_TKC2 = value;} }
		public String TKC3{	get{ return _TKC3;} set{_TKC3 = value;} }
		public String TENTK{	get{ return _TENTK;} set{_TENTK = value;} }
		public Int16 TCHAT{	get{ return _TCHAT;} set{_TCHAT = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public ACC_SYSInfo()
		{
			_TKC1 = "";
			_TKC2 = "";
			_TKC3 = "";
			_TENTK = "";
			_TCHAT = (Int16)0;
		}
		public ACC_SYSInfo(
		String TKC1,
		String TKC2,
		String TKC3,
		String TENTK,
		Int16 TCHAT
		)
		{
			_TKC1 = TKC1;
			_TKC2 = TKC2;
			_TKC3 = TKC3;
			_TENTK = TENTK;
			_TCHAT = TCHAT;
		}
		public ACC_SYSInfo(DataRow dr)
		{
			if (dr != null)
			{
				_TKC1 = dr[Field.TKC1.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TKC1.ToString()]);
				_TKC2 = dr[Field.TKC2.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TKC2.ToString()]);
				_TKC3 = dr[Field.TKC3.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TKC3.ToString()]);
				_TENTK = dr[Field.TENTK.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TENTK.ToString()]);
				_TCHAT = dr[Field.TCHAT.ToString()] == DBNull.Value?(Int16)0:Convert.ToInt16(dr[Field.TCHAT.ToString()]);
			}
		}
		public ACC_SYSInfo(DataRowView dr)
		{
			if (dr != null)
			{
				_TKC1 = dr[Field.TKC1.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TKC1.ToString()]);
				_TKC2 = dr[Field.TKC2.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TKC2.ToString()]);
				_TKC3 = dr[Field.TKC3.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TKC3.ToString()]);
				_TENTK = dr[Field.TENTK.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TENTK.ToString()]);
				_TCHAT = dr[Field.TCHAT.ToString()] == DBNull.Value?(Int16)0:Convert.ToInt16(dr[Field.TCHAT.ToString()]);
			}
		}
		public ACC_SYSInfo(ACC_SYSInfo objEntr)
		{			
			_TKC1 = objEntr.TKC1;			
			_TKC2 = objEntr.TKC2;			
			_TKC3 = objEntr.TKC3;			
			_TENTK = objEntr.TENTK;			
			_TCHAT = objEntr.TCHAT;			
		}
        #endregion Constructor
        
        #region InitTable
		public static DataTable ToDataTable()
		{
			DataTable dt = new DataTable("ACC_SYS");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.TKC1.ToString(), typeof(String)),
				new DataColumn(Field.TKC2.ToString(), typeof(String)),
				new DataColumn(Field.TKC3.ToString(), typeof(String)),
				new DataColumn(Field.TENTK.ToString(), typeof(String)),
				new DataColumn(Field.TCHAT.ToString(), typeof(Int16))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.TKC1.ToString()] = _TKC1;
			row[Field.TKC2.ToString()] = _TKC2;
			row[Field.TKC3.ToString()] = _TKC3;
			row[Field.TENTK.ToString()] = _TENTK;
			row[Field.TCHAT.ToString()] = _TCHAT;
			return row;
		}
        #endregion InitTable
    }
}
